﻿<training:TrainingScript xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    x:Class="Sample01.DemoTrainingScript"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:training="clr-namespace:Invini.Training;assembly=Invini.Training"
                    xmlns:tools="clr-namespace:Invini.Tools;assembly=Invini.Tools">
    
    <training:TrainingScript.Resources>
        <training:PathComponentsCollection x:Key="Window">
            <training:VisualChildComponent IncludeMe="True"
                                           Type="Sample01.MainWindow" />
        </training:PathComponentsCollection>
        <training:PathComponentsCollection x:Key="Button">
            <training:VisualChildComponent IncludeMe="True"
                                           Type="Sample01.MainWindow" />
            <training:VisualChildComponent Type="System.Windows.Controls.Button" />
        </training:PathComponentsCollection>
        <training:PathComponentsCollection x:Key="CheckBox">
            <training:VisualChildComponent IncludeMe="True"
                                           Type="Sample01.MainWindow" />
            <training:VisualChildComponent Type="System.Windows.Controls.CheckBox" />
        </training:PathComponentsCollection>
        <training:PathComponentsCollection x:Key="TextBox">
            <training:VisualChildComponent IncludeMe="True"
                                           Type="Sample01.MainWindow" />
            <training:VisualChildComponent Type="System.Windows.Controls.TextBox" />
        </training:PathComponentsCollection>
        <training:PathComponentsCollection x:Key="PasswordBox">
            <training:VisualChildComponent IncludeMe="True"
                                           Type="Sample01.MainWindow" />
            <training:VisualChildComponent Type="System.Windows.Controls.PasswordBox" />
        </training:PathComponentsCollection>
    </training:TrainingScript.Resources>
    
    <training:UnconditionalTrigger>
        <training:RestrictInterfaceAction />
        <training:InstructAction Element="{tools:Resource Window}"
                                 Placement="Center"
                                 MaxWidth="400"
                                 Button="Continue">
            <TextBlock>
                Hi! This is demo application which is going to teach you how Invini.Training library may be used.<LineBreak />
                This popup is shown by this library. Please consider that entire interface of the window (controls inside it) are blocked now. This is done by library. You may script it!<LineBreak />
                One and only thing you are able to do knwo is to click "Continue" button.                
            </TextBlock>
        </training:InstructAction>
    </training:UnconditionalTrigger>
    
    <training:UnconditionalTrigger>
        <training:RestrictInterfaceAction />
        <training:DecorateAction Element="{tools:Resource Button}" />
        <training:InstructAction Element="{tools:Resource Button}"
                                 Placement="Right"
                                 MaxWidth="300"
                                 Button="Continue">
            <TextBlock>
                Script may decorate some control with red border and show message near it.<LineBreak />
                Entire interface is still locked.
            </TextBlock>
        </training:InstructAction>
    </training:UnconditionalTrigger>

    <training:UnconditionalTrigger>
        <training:RestrictInterfaceAction Element="{tools:Resource Button}" />
        <training:DecorateAction Element="{tools:Resource Button}" />
        <training:InstructAction Element="{tools:Resource Button}"
                                 Placement="Bottom"
                                 MaxWidth="300">
            <TextBlock>
                Script unlocked the button now. Click on it!
            </TextBlock>
        </training:InstructAction>
    </training:UnconditionalTrigger>
    
    <training:EventTrigger Element="{tools:Resource Button}"
                           EventName="Click">
        <training:RestrictInterfaceAction />
        <training:InstructAction Element="{tools:Resource Window}"
                                 Placement="Center"
                                 MaxWidth="200"
                                 Button="Continue">
            <TextBlock>
                As you see script may react to events!
            </TextBlock>
        </training:InstructAction>
    </training:EventTrigger>

    <training:UnconditionalTrigger>
        <training:RestrictInterfaceAction Element="{tools:Resource TextBox}" />
        <training:DecorateAction Element="{tools:Resource TextBox}" />
        <training:InstructAction Element="{tools:Resource TextBox}"
                                 Placement="Right"
                                 MaxWidth="200">
            <TextBlock>
                Move the keyboard focus to text box now.
            </TextBlock>
        </training:InstructAction>
    </training:UnconditionalTrigger>

    <training:EventTrigger Element="{tools:Resource TextBox}"
                           EventName="GotFocus">
        <training:RestrictInterfaceAction Element="{tools:Resource TextBox}" />
        <training:DecorateAction Element="{tools:Resource TextBox}" />
        <training:RestrictTextAction Element="{tools:Resource TextBox}"
                                     PropertyName="Text"
                                     Text="invini" />
        <training:InstructAction Element="{tools:Resource TextBox}"
                                 Placement="Right"
                                 MaxWidth="200">
            <TextBlock>
                Type "invini". The scipt won't allow you to type anything else!
            </TextBlock>
        </training:InstructAction>
    </training:EventTrigger>
    
    <training:ValueTrigger Element="{tools:Resource TextBox}"
                           PropertyName="Text"
                           Value="invini">
        <training:RestrictInterfaceAction />
        <training:InstructAction Element="{tools:Resource Window}"
                                 Placement="Center"
                                 Button="Continue"
                                 MaxWidth="300">
            <TextBlock>
                Well done! As you see, script may monitor property value!
            </TextBlock>
        </training:InstructAction>
    </training:ValueTrigger>

    <training:UnconditionalTrigger>
        <training:RestrictInterfaceAction />
        <training:InstructAction Element="{tools:Resource Window}"
                                 Placement="Center"
                                 Button="Continue"
                                 MaxWidth="300">
            <TextBlock>
                You have learned some basics of training scripting. There is much more!<LineBreak />
                When you click "Continue" button application will be closed. It is scripted also!
            </TextBlock>
        </training:InstructAction>
    </training:UnconditionalTrigger>
    
    <training:UnconditionalTrigger>
        <training:ExitApplicationAction />
    </training:UnconditionalTrigger>
</training:TrainingScript>